layui.define(['form', 'layedit', 'table', 'laydate'], function (exports) {
    let $ = layui.$;
    let form = layui.form;
    let table = layui.table;
    // 分类下拉框联动
    form.render(null, "zmn-form");
    let channelPriceCityId = new Array();
    let channelBaseCityId = new Array();

    $("#deposit").val(json.channelPriceVO.deposit > 0 ? (json.channelPriceVO.deposit / 100) : '')

    if (json.onePriceList !== null && json.onePriceList.length > 0) {

        json.onePriceList.forEach(function (data) {
            let cityName = "";
            if (data.cityName !== null && data.cityName !== undefined) {
                cityName = data.cityName;
            }
            let cityId = data.cityId;
            if (data.cityId == null) {
                cityId = data.provinceId;
            }
            $('#addCityDiv').append('<span name="cityprice" value=' + data.provinceId + '&' + cityId + ' ' +
                'style="display: inline-block;width: auto;border: 1px solid #ccc;' +
                'border-radius: 10px;padding: 5px 20px;\t\t\tmargin-right: 5px;tmargin-bottom: 5px;background-color: #009688;color:#fff;">' +
                '' + data.provinceName + cityName + '</span>');

            channelPriceCityId.push(data.provinceId + '&' + cityId);
        });
    }

    if (json.basePriceList !== null && json.basePriceList.length > 0) {
        json.basePriceList.forEach(function (data) {
            let cityName = "";
            if (data.cityName !== null && data.cityName !== undefined) {
                cityName = data.cityName;
            }
            let cityId = data.cityId;
            if (data.cityId == null) {
                cityId = data.provinceId;
            }
            $('#addCityDiv1').append('<span name="cityprice" value=' + data.provinceId + '&' + cityId + ' style="display: inline-block;' +
                'width: auto;border: 1px solid #ccc;border-radius: 10px;padding: 5px 20px;' +
                '\\t\\t\\tmargin-right: 5px;tmargin-bottom: 5px;background-color: #009688;' +
                'color:#fff;">' + data.provinceName + cityName + ' <i></i></span>');
            channelBaseCityId.push(data.provinceId + '&' + cityId);
        });
    }

    let data = {"code": 0, "msg": "", "count": json.totalCount, "items": json.items};
    let cols = [
        [{
            field: 'createTime', title: '操作时间', align: 'center', templet: function (row) {
                return zmnUtil.createTime(row.createTime);
            }
        },
            {field: 'abutmenter', title: '操作人', align: 'center'},
            {field: 'content', title: '操作内容', align: 'center'}
        ]
    ];
    if (json.channelPriceVO.channelPriceId === null) {
        json.channelPriceVO.channelPriceId = 0;
    }
    zmnLayUtil.layTableRender(table, cols, "zmn-channel-price-log-table",
        data, "/pilot/channel/price/loadChannelPriceLog.action?relationId=" + json.channelPriceVO.channelPriceId);


    exports('channel_price_detail_js', {});
})
;
